<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 统计⼀个字符串中某个字符出现的次数 -->
    <script>
        // var arr = 'adsdahifnfotj';
        // var you = arr.match(/f/gi);
        // console.log('出现了'+you.length+'次');
        var sava = prompt('字符串中某个字符出现的次数,adsdahifnfotj');
        var arr = 'adsdahifnfotj';
        var you = sava.match(arr);
        alert('出现了'+you.length+'次'); 
    </script>
</body>
</html>